//
//  RegistrationConfirmAgreeCell.swift
//  EyeVisionForPatients
//
//  Created by qdsg on 2020/5/7.
//  Copyright © 2020 QDSG. All rights reserved.
//

import UIKit

protocol SERegistrationConfirmAgreeCellDelegate: NSObjectProtocol {
    func registrationConfirmAgreeCellAgreeBtnAction(sender: UIButton)
}

class SERegistrationConfirmAgreeCell: UITableViewCell {

    static let className = "SERegistrationConfirmAgreeCell"
    static let reuseId = className

    weak var delegate: SERegistrationConfirmAgreeCellDelegate?

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    
    @IBOutlet weak var agreeLabel: UILabel! {
        didSet {
            agreeLabel.isUserInteractionEnabled = true
            let tap = UITapGestureRecognizer(target: self, action: #selector(agreeLabelClicked))
            agreeLabel.addGestureRecognizer(tap)
        }
    }
    
    @objc func agreeLabelClicked() {
//        let agreementView = UINib.loadViewFrom(AgreementAlertView.self)
//        agreementView.show(type: .registrationRule)
    }
    
    
    @IBAction func agreeBtnAction(_ sender: UIButton) {
        sender.isSelected.toggle()
        delegate?.registrationConfirmAgreeCellAgreeBtnAction(sender: sender)
    }
    

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
